package com.extasy.booktextdemo;

import luck.technology.booktext.BookText;
import luck.technology.booktext.BookTextView;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		BookTextView rootView = new BookTextView(this);
		BookText text = new BookText("General relativity, or the general" +
				" theory of relativity, is the geometric theory of gravitation" +
				" published by Albert Einstein in 1916 and the current" +
				" description of gravitation in modern physics. ");
		
		text.appendBoldItalic(" General relativity generalizes special " +
				"relativity and Newton's law of universal gravitation, " +
				"providing a unified description of gravity as a geometric " +
				"property of space and time, or spacetime. \n<br>\n<br>")
				.append("This demo app shows capabilities of the ")
				.appendBold("BookTextView")
				.append(" class. ")
				.appendSuperscript("Simple text justification and styling in Android");
		text.setStyleFactor(BookText.STYLE_SMALL_TEXT);
		text.setDecodeHTMLSymbols(true);
		rootView.setText(text);
		rootView.setPadding(
				getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin), 
				getResources().getDimensionPixelSize(R.dimen.activity_vertical_margin), 
				getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin), 
				getResources().getDimensionPixelSize(R.dimen.activity_vertical_margin));
		setContentView(rootView);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {

		return false;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {

		return super.onOptionsItemSelected(item);
	}
}
